package cloud.seckill.ribbonserver.result;

import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @title: Result
 * @Author Wangsj
 * @Date: 2021/5/24
 */
@Builder
@Data
public class Result {
    public Integer code;

    public String message;

    public Object data;

    public Result() {
    }

    public Result(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static Result ok(){return Result.builder().code(0).message("success").build();};

    public static Result ok(String msg){
        return Result.builder().code(0).message(msg).build();
    }

    public static Result ok(String msg,Object data){
        return Result.builder().code(0).message(msg).data(data).build();
    }

    public static Result err(String msg){
        return Result.builder().code(-1).message(msg).build();
    }
}


